<script>
function delay(ms) {
  return new Promise((resolve, reject) => {
    setTimeout(resolve, ms)
  })
}

function 史记买鸡肉() {
  return delay(2000).then(() => {
    return '鸡肉'
    throw '没带钱'
  })
}
function 张尧买花生() {
  return delay(1500).then(() => {
    return '花生'
    // throw '掉沟里了'
  })
}
function 成子睿买大葱() {
  return delay(3000).then(() => '大葱')
}
const begin = Date.now()
const p = Promise.all([
  史记买鸡肉(), 张尧买花生(), 成子睿买大葱(),
  Promise.resolve('辣椒'), '糖', '醋'
]).then((食材) => {
  console.log(食材, Date.now() - begin)
  return '宫保鸡丁'
}).catch(r => {
  console.log(r, Date.now() - begin)
})
</script>